<?php
namespace Admin\Model;
use Think\Model;
class SettingModel extends Model {
	public $post; //提交的信息 数组

	//获取设置信息
	public function get_setting_info()
	{
		$Model=M("Setting");
		$list=$Model->select();
		$info=array();
		foreach($list as $k=>$v){
			$info[$v['name']]=$v['value'];
		}
		return $info;
	}

	//提交设置
	public function setting_post()
	{
		$Model=M("Setting");
		foreach($this->post as $k=>$v){
			$condition['name']=$k;
			$data['value']=$v;
			$result=$Model->where($condition)->save($data);
			if($result === false) {
				return false;
			}
		}
		return true;
	}

	//搜索设置
	public function hot_search(){
		$Model=M("hot_search");
		$list=$Model->select();
		foreach ($list as $k => $v) {
			$hot_word=$v['hot_search'];
		}
		return $hot_word;
	}
}